package ru.pb.game.network.engine.client.packets.sendable;

import org.apache.log4j.Logger;

import ru.pb.game.network.engine.client.packets.GameServerToClientPacket;
import ru.pb.game.objects.model.inventory.emuns.EQMIPEMENT_SLOT;
import ru.pb.game.objects.model.players.Player;
import ru.pb.game.objects.model.room.Room;

/**
 * Пакет начала боя.
 * 
 * @author DarkSkeleton
 */

public class PROTOCOL_BATTLE_STARTBATTLE_ACK extends GameServerToClientPacket
{
	private static final Logger _log = Logger.getLogger(PROTOCOL_BATTLE_STARTBATTLE_ACK.class);

	private Player _p;
	private Room _room;

	public PROTOCOL_BATTLE_STARTBATTLE_ACK(Player p)
	{
		_p = p;
		_room = p.getRoom();
		_room.startBattle(p.getObjectId());
	}

	@Override
	public void writeImpl()
	{
		_log.info("START BATTLE SLOT " + _p.getSlot() + " TYPE " + _room.room_type + " MAP " + _room.map_id + " LEADER " + _room.getLeader());
		writeB(new byte[] {0x08, 0x0f});
		writeBoolD(_room.isInFight());
		writeD(_p.getSlot()); // Номер слота

		writeD(_p.getInventory().getItemIdBySlot(EQMIPEMENT_SLOT.SLOT_CHAR_RED)); // красный скин
		writeD(_p.getInventory().getItemIdBySlot(EQMIPEMENT_SLOT.SLOT_CHAR_BLUE)); // синий скин
		writeD(_p.getInventory().getItemIdBySlot(EQMIPEMENT_SLOT.SLOT_CHAR_HEAD)); // Шлем
		writeD(_p.getInventory().getItemIdBySlot(EQMIPEMENT_SLOT.SLOT_CHAR_ITEM)); // Берет
		writeD(_p.getInventory().getItemIdBySlot(EQMIPEMENT_SLOT.SLOT_DINO)); // Дино скин.

		writeC(2); // хз что это
		writeC();
		writeH();
		
	}
}